module.exports = app => {
    const { STRING, INTEGER, DATE } = app.Sequelize;
    const PostResponse = app.model.define('post_response', {
        id: {
            type: INTEGER(20),
            primaryKey: true,
            autoIncrement: true,
            comment:"自增ID"
        },
        commentId: {
            type: INTEGER(20),
            allowNull: false,
            defaultValue: 0,
            comment: '回复的评论的id'
        },
        fromId: {
            type: INTEGER(20),
            allowNull: false,
            defaultValue: 0,
            comment: '回复人id'
        },
        content: {
            type: STRING,
            allowNull: false,
            defaultValue: '',
            comment: '回复内容'
        },
        created_time: DATE,
        updated_time: DATE,
    });
    // 关联关系
    PostResponse.associate = function (models) {
        // 关联用户
        PostResponse.belongsTo(app.model.User);
        // 关联帖子评论
        PostResponse.belongsTo(app.model.PostComment);
    }
    return PostResponse;
};